<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
    <title id="bv20941">ALTER SERVER</title>
    <body>
        <p id="sql_command_desc">Changes the definition of a foreign server.</p>
        <section id="section2">
            <title>Synopsis</title>
            <codeblock id="sql_command_synopsis">ALTER SERVER <varname>server_name</varname> [ VERSION '<varname>new_version</varname>' ]
    [ OPTIONS ( [ ADD | SET | DROP ] <varname>option</varname> ['<varname>value</varname>'] [, ... ] ) ]

ALTER SERVER <varname>server_name</varname> OWNER TO <varname>new_owner</varname>
                
ALTER SERVER <varname>server_name</varname> RENAME TO <varname>new_name</varname></codeblock>
        </section>
        <section id="section3">
            <title>Description</title>
            <p><codeph>ALTER SERVER</codeph> changes the definition of a foreign server.
                The first form of the command changes the version string or the generic options of 
                the server. Greenplum Database requires at least one clause. The second and third forms of the command change the owner or the name of the server.</p>
            <p>To alter the server, you must be the owner of the server. To alter the owner you must:<ul>
              <li>Own the server.</li>
              <li>Be a direct or indirect member of the new owning role.</li>
              <li>Have <codeph>USAGE</codeph> privilege on the server's foreign-data wrapper.</li></ul></p>
            <p>Superusers automatically satisfy all of these criteria.</p>
        </section>
        <section id="section4">
            <title>Parameters</title>
            <parml>
                <plentry>
                    <pt><varname>server_name</varname></pt>
                    <pd>
                        <p>The name of an existing server.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt><varname>new_version</varname></pt>
                    <pd>
                        <p>The new server version.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>OPTIONS ( [ ADD | SET | DROP ] <varname>option</varname>  ['<varname>value</varname>'] [, ... ] )</pt>
                    <pd>
                        <p>Change the server's options. <codeph>ADD</codeph>, <codeph>SET</codeph>, and <codeph>DROP</codeph> specify the action to perform. If no operation is explicitly specified, the default operation is <codeph>ADD</codeph>. Option names must be unique. Greenplum Database validates names and values using the server's foreign-data wrapper library.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>OWNER TO <varname>new_owner</varname></pt>
                    <pd>
                        <p>Specifies the new owner of the foreign server.</p>
                    </pd>
                </plentry>
                <plentry>
                    <pt>RENAME TO <varname>new_name</varname></pt>
                    <pd>
                        <p>Specifies the new name of the foreign server.</p>
                    </pd>
                </plentry>
            </parml>
        </section>
        <section id="section6">
            <title>Examples</title>
            <p>Change the definition of a server named <codeph>foo</codeph> by adding connection options:</p><codeblock>ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb');</codeblock>
            <p>Change the option named <codeph>host</codeph> for a server named <codeph>foo</codeph>, and set the server version:</p><codeblock>ALTER SERVER foo VERSION '9.1' OPTIONS (SET host 'baz');</codeblock>
        </section>
        <section id="section7">
            <title>Compatibility</title>
            <p><codeph>ALTER SERVER</codeph> conforms to ISO/IEC 9075-9 (SQL/MED). The <codeph>OWNER
                    TO</codeph> and <codeph>RENAME</codeph> forms are Greenplum Database extensions.
            </p>
        </section>
        <section id="section8">
            <title>See Also</title>
            <p><codeph><xref href="CREATE_SERVER.xml#topic1">CREATE SERVER</xref></codeph>,
                        <codeph><xref href="DROP_SERVER.xml#topic1">DROP
                    SERVER</xref></codeph></p>
        </section>
    </body>
</topic>
